package com.titanium.client.Titanium.Media;

public class SoundJSNI
{
	
	public static native void initMediaSound() /*-{
	 __MediaSound = new Array();
	}-*/;
	
	public static native void createSound(String path, String soundId) /*-{
	 var sound = Titanium.Media.createSound(path);
	 __MediaSound[soundId] = sound;
	}-*/;
	
	public static native int getVolume(String soundId) /*-{
	 var volume = __MediaSound[soundId].getVolume();
	 return Math.floor(volume * 100);
	}-*/;
	
	public static native void play(String soundId) /*-{
	 __MediaSound[soundId].play();
	}-*/;
	
	public static native boolean isLooping(String soundId) /*-{
	 return  __MediaSound[soundId].isLooping();
	}-*/;
	
	public static native boolean isPaused(String soundId) /*-{
	 return  __MediaSound[soundId].isPaused();
	}-*/;
	
	public static native boolean isPlaying(String soundId) /*-{
	 return  __MediaSound[soundId].isPlaying();
	}-*/;
	
	public static native void pause(String soundId) /*-{
	   __MediaSound[soundId].pause();
	}-*/;
	
	public static native void reload(String soundId) /*-{
	   __MediaSound[soundId].reload();
	}-*/;
	
	public static native void setLooping(String soundId, boolean shouldLoop) /*-{
	   __MediaSound[soundId].setLooping(shouldLoop);
	}-*/;
	
	public static native void setVolume(String soundId, String vol) /*-{
	  __MediaSound[soundId].setVolume(parseInt(vol) / 100);
	}-*/;
	
	
}
